package cs342.project1.mathNotebook.gui;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import javax.swing.*;

public class StartScreen extends JFrame {
	
	private final int width = 400, height = 400;
	private JButton login_button, create_button;
	
	public StartScreen() {
	    
		// Initial Frame Setup
		this.setSize(width, height);
		this.setTitle("MathGraph - Now in the Cloud!");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setLocationRelativeTo(null);
		this.setLayout(null);
		
		// Login Button
		login_button = new JButton("Login");
		login_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                login_buttonActionPerformed(evt);
            }
        });
		login_button.setSize(200,150);
	    login_button.setLocation(this.width/2-login_button.getWidth()/2, this.height/2-login_button.getHeight());
		this.add(login_button);
		
		// Create account Button
		create_button = new JButton("Create Account");
		create_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                create_buttonActionPerformed(evt);
            }
        });
		create_button.setSize(200,150);
		create_button.setLocation(this.width/2-create_button.getWidth()/2,this.height/2);
		this.add(create_button);
	}
	
	public void login_buttonActionPerformed(java.awt.event.ActionEvent evt){
	    this.dispose();
	    new LoginScreen().setVisible(true);
	}
	
	private void create_buttonActionPerformed(ActionEvent evt) {
        this.dispose();
        new CreateScreen().setVisible(true);
	}
}